/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package planspiel.panels;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;

import javax.swing.BorderFactory;
import javax.swing.JPanel;
import javax.swing.border.Border;

import planspiel.Game;
import planspiel.GameRoundController;
import planspiel.PlanspielView;
import planspiel.panels.subpanels.GameContentCandidate;
import planspiel.panels.subpanels.GameContentMessage;
import planspiel.panels.subpanels.GameContentPlatform;
import planspiel.panels.subpanels.GameContentTip;
import planspiel.panels.subpanels.GameContentVacancy;
import planspiel.panels.subpanels.GameFooter;
import planspiel.panels.subpanels.GameHeader;
import planspiel.panels.subpanels.GameNavigation;

/**
 *
 * @author Administrator
 */
public class GameScreen extends JPanel implements MyAbstractPanel{
    
    private static final long serialVersionUID = 4920541981126757264L;
    private PlanspielView planSpiel = null;
    private Game game = null;

    private GameContentVacancy contentVacancy = null;
    private GameContentPlatform contentPlatform = null;
    private GameContentCandidate contentCandidate = null;
    private GameContentMessage contentMessage = null;
    private GameContentTip contentTip = null;

    private GameHeader header = null;
    private GameFooter footer = null;
    private GameNavigation navigation = null;
    
    /**
     * 
     * @param game
     */
    public GameScreen(Game game) {
        this.game = game;
    }

    /**
     * 
     * @return
     */
    public GameContentVacancy getContentVacancy() {
        return contentVacancy;
    }

    /**
     * 
     * @return
     */
    public GameContentPlatform getContentPlatform() {
        return contentPlatform;
    }

    /**
     * 
     * @return
     */
    public GameContentCandidate getContentCandidate() {
        return contentCandidate;
    }

    /**
     * 
     * @return
     */
    public GameContentMessage getContentMessage() {
        return contentMessage;
    }

    /**
     * 
     * @return
     */
    public GameFooter getFooter() {
        return footer;
    }

    /**
     * 
     * @return
     */
    public GameHeader getHeader() {
        return header;
    }

    /**
     * 
     * @return
     */
    public GameNavigation getNavigation() {
        return navigation;
    }

    /**
     * 
     */
    public void paintScreen() {
        try {
            int gameStage = getGame().getCurrentGameRoundController().getSelectedGameStage();
            Dimension contentDimension = new Dimension(300, 300);
            Border border = BorderFactory.createLineBorder(Color.BLACK);
            JPanel contentPanel = null;
            
            //Init Content Panel
            if(gameStage == GameRoundController.VACANCYSTAGE){
                contentVacancy = new GameContentVacancy(this);
                contentPanel = contentVacancy;
            } else if(gameStage == GameRoundController.PLATFORMSTAGE){
                contentPlatform = new GameContentPlatform(this);
                contentPanel = contentPlatform;
            } else if(gameStage == GameRoundController.CANDIDATESTAGE){
                contentCandidate = new GameContentCandidate(this);
                contentPanel = contentCandidate;
            } else if(gameStage == GameRoundController.MESSAGESTAGE){
                contentMessage = new GameContentMessage(this);
                contentPanel = contentMessage;
            } else if(gameStage == GameRoundController.TIPSTAGE){
                contentTip = new GameContentTip(this);
                contentPanel = contentTip;
            }

            contentPanel.setMinimumSize(contentDimension);
            contentPanel.setMaximumSize(contentDimension);
            contentPanel.setSize(contentDimension);
            contentPanel.setBorder(border);

            header = new GameHeader(this);
            header.setBorder(border);
            
            footer = new GameFooter(this);
            footer.setBorder(border);
            
            navigation = new GameNavigation(this);
            navigation.setBorder(border);

            BorderLayout layout = new BorderLayout();
            this.setLayout(layout);
            
            this.add(header, BorderLayout.NORTH);            
            this.add(contentPanel, BorderLayout.CENTER);
            this.add(navigation, BorderLayout.EAST);
            this.add(footer, BorderLayout.SOUTH);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    /**
     * 
     * @param planSpiel
     */
    public void setPlanspielView(PlanspielView planSpiel) {
        this.planSpiel = planSpiel;
    }

    /**
     * 
     * @return
     */
    public Game getGame() {
        return game;
    }
}
